package br.com.bd2.hibernate.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(uniqueConstraints = {@UniqueConstraint(name = "uk_empresa_codigo", columnNames = {"codigoEmpresa", "holding"})})
public class Empresa {
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_empresa")
	@SequenceGenerator(name="seq_empresa", sequenceName="seq_empresa")
	private Long id;
	
	@Column(nullable=false)
	private Long codigoEmpresa;
	
	@Column(length=50)
	private String razaoSocial;
	
	@Column(length=50)
	private String fantasia;
	
	@Column(length=50)
	private String logradouro;
		
	@ManyToOne
	@JoinColumn(name="holding", nullable=false)
	private Holding holding;
	
	//@OneToMany(mappedBy="empresa")
	//public List<Loja> lojas;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getRazaoSocial() {
		return razaoSocial;
	}
	
	public Long getCodigoEmpresa() {
		return codigoEmpresa;
	}

	public void setCodigoEmpresa(Long codigoEmpresa) {
		this.codigoEmpresa = codigoEmpresa;
	}

	public void setRazaoSocial(String razaoSocial) {
		this.razaoSocial = razaoSocial;
	}

	public String getFantasia() {
		return fantasia;
	}

	public void setFantasia(String fantasia) {
		this.fantasia = fantasia;
	}

	public String getLogradouro() {
		return logradouro;
	}

	public void setLogradouro(String logradouro) {
		this.logradouro = logradouro;
	}

	public Holding getHolding() {
		return holding;
	}

	public void setHolding(Holding holding) {
		this.holding = holding;
	}

//	public List<Loja> getLojas() {
//		return lojas;
//	}
//
//	public void setLojas(List<Loja> lojas) {
//		this.lojas = lojas;
//	}	
}
